$(function () {
    currentMenu();

    function currentMenu() {
        var url = window.location.href;
        var ularr = $("#bs-example-navbar-collapse-1>ul");
        if(ularr!=null && ularr.length>0){
            var arr = $(ularr[0]).find("li>a");
            $(arr).each(function (index,em) {
               if(em.href==url){
                   $(em).parent().addClass('active');
               }
            });
        }
    }
});